package com.group.project.hrms.utils;

import com.group.project.hrms.entity.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;


/**
 * 该类是专门针对薪资的计算工具类
 */
public class SalaryUtil {

    //用于缓存统计计算结果，以便归档时直接写入数据库
    public static List<SalaryMonthlyReport> reportList;


    /**
     * 用于将List<SalaryBaseWithHold>转为Map<String, SalaryBaseWithHold>
     * @param list
     * @return
     */
    public Map<String, SalaryBaseWithHold> getSalaryBaseWithHoldMap(List<SalaryBaseWithHold> list){
        Map<String, SalaryBaseWithHold> resultMap = new HashMap<>();
        if(null != list && list.size() != 0){
            for (SalaryBaseWithHold sbwh : list
                 ) {
                resultMap.put(sbwh.getContactId(), sbwh);
            }
        }
        return resultMap;
    }


    /**
     * 用于将List<SalaryBaseAllowanceReward>转为Map<String, SalaryBaseAllowanceReward>
     * @param list
     * @return
     */
    public Map<String, SalaryBaseAllowanceReward> getSalaryBaseAllowanceRewardMap(List<SalaryBaseAllowanceReward> list){
        Map<String, SalaryBaseAllowanceReward> resultMap = new HashMap<>();
        if(null != list && list.size() != 0){
            for (SalaryBaseAllowanceReward sbar : list
                 ) {
                resultMap.put(sbar.getContactId(), sbar);
            }
        }
        return resultMap;
    }


    /**
     * 用于将List<AttendanceMonthlyReport>转为Map<String, AttendanceMonthlyReport>
     * @param list
     * @return
     */
    public Map<String, AttendanceMonthlyReport> getAttendanceMonthlyReportMap(List<AttendanceMonthlyReport> list){
        Map<String, AttendanceMonthlyReport> resultMap = new HashMap<>();
        if(null != list && list.size() != 0){
            for (AttendanceMonthlyReport amr : list
                 ) {
                resultMap.put(amr.getContactId(), amr);
            }
        }
        return resultMap;
    }


    /**
     * 用于将List<StandardBonusFullAttendance>转为Map<String, StandardBonusFullAttendance>
     * @param list
     * @return
     */
    public Map<String, StandardBonusFullAttendance> getStandardBonusFullAttendanceMap(List<StandardBonusFullAttendance> list){
        Map<String, StandardBonusFullAttendance> resultMap = new HashMap<>();
        if(null != list && list.size() != 0){
            for (StandardBonusFullAttendance sbfa : list
                 ) {
                resultMap.put(sbfa.getAttendGroupId(), sbfa);
            }
        }
        return resultMap;
    }


    /**
     * 用于将List<StandardBaseAttendChargeBack>转为Map<String, StandardBaseAttendChargeBack>
     * @param list
     * @return
     */
    public Map<String, StandardBaseAttendChargeBack> getStandardBaseAttendChargeBackMap(List<StandardBaseAttendChargeBack> list){
        Map<String, StandardBaseAttendChargeBack> resultMap = new HashMap<>();
        if(null != list && list.size() != 0){
            for (StandardBaseAttendChargeBack sbac : list
                 ) {
                resultMap.put(sbac.getAttendGroupId(), sbac);
            }
        }
        return resultMap;
    }


    /**
     * 用于将List<StandardBaseAttendExtraHours>转为Map<String, StandardBaseAttendExtraHours>
     * @param list
     * @return
     */
    public Map<String, StandardBaseAttendExtraHours> getStandardBaseAttendExtraHoursMap(List<StandardBaseAttendExtraHours> list){
        Map<String, StandardBaseAttendExtraHours> resultMap = new HashMap<>();
        if(null != list && list.size() != 0){
            for (StandardBaseAttendExtraHours sbaeh : list
                 ) {
                resultMap.put(sbaeh.getAttendGroupId(), sbaeh);
            }
        }
        return resultMap;
    }

}
